package com.briup.shopadmin.dao;

import com.briup.shopadmin.common.bean.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface IUserDao extends JpaRepository<User,Long> {

    long countByGender(String gender);

    Page<User> findByLoginNameContaining(String username, PageRequest pageRequest);
    @Query(nativeQuery = true,value = "update t_user set  is_lock = false  where id =?1")
    @Modifying
    void enable(long id);
    @Query(nativeQuery = true,value = "update t_user set  is_lock = true  where id =?1")
    @Modifying
    void disable(long id);
}